@extends('layouts.mobile_main')

@section('title', '搜索')

@section('resources')
    @parent
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <link rel="stylesheet" href="{{ env('CSS_DOMAIN') }}css/public.css?v={{env('CSS_VERSION')}}">
    <script src="{{env('JS_DOMAIN')}}js/adaptation.js?v={{env('JS_VERSION')}}"></script>
    <style>
        .search_page input{width: 6rem;height: 0.7rem;border: 1px solid #9a54c6;border-radius: 0.2rem;margin: 0.3rem 0.5rem 0.3rem 0.8rem;background: url({{env('IMAGE_DOMAIN')}}images/search_p.png) 0.2rem 0.16rem no-repeat;background-size: 0.48rem;padding-left: 1rem;}
        .busy_name{display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;width: 6.5rem;}
    </style>
@endsection

@section('content')
	<!-- <header class="search_result oh pr">
		<a onclick="history.go(-1);" class="fl" href=""><img class="fl" src="{{env('IMAGE_DOMAIN')}}images/back_p.png?v={{env('IMAGE_VERSION')}}" alt=""></a>
		<input class="fl fz_40 search_contant" type="text" placeholder="输入商家、分类或商圈">
	</header> -->
    <header class="search_page oh" style="position: fixed;top: 0;left: 0;background: #fff;z-index: 20;">
        <a class="fl" href="javascript:history.go(-1);"><img class="fl" src="{{env('IMAGE_DOMAIN')}}images/back_p.png?v={{env('IMAGE_VERSION')}}" alt=""></a>
        <input class="fl fz_40 search_contant" type="text" name="search" value="{{$search}}">
        <span class="fl fz_48 co_violet search_search" id="submit_search1">搜索</span>
        <!-- <span class="fl fz_48 co_violet search_search" id="submit_search2" style="display: none;">取消</span> -->
    </header>
	<section style="margin-top: 1.32rem;">
		<ul class="nearby_all">
			<!-- 有数据-->
			@if(count($lists) > 0)
                @foreach($lists as $list)
                <li class="oh nearby_cen">
                    <a href="/mobile/shop/get?shopid={{$list['shopid']}}&cityid={{$cityid}}&mylongitude={{$mylongitude}}&mylatitude={{$mylatitude}}">
                        <div class="fl nearby_busypic pr">
                            @if($list['shopstatus'] == 1)
                                @if($list['todayevent'] == '0')
                                    <p class="search_time fz_28 tc">{{date('Y-m-d', strtotime($list['nextevent']))}}</p>
                                @else
                                    <p class="search_time fz_28 tc">今日翻倍花</p>
                                @endif
                            @else
                                {{--下架显示内容--}}
                            @endif
                            <img class="fl" src="{{env('IMAGE_DOMAIN')}}{{$list['logo']}}" alt="">
                        </div>
                        <div class="fr nearby_busytext">
                            <div class="fz_44 oh">
                                <h2 class="fl fz_44 busy_name">{{$list['name']}}</h2>
                                {{--<em class="fr nearby_score">{{$list['commentmark']}}分</em>--}}
                            </div>
                            <p class="fz_34 oh nearby_family">
                                <span class="fl">{{$list['secondclassname']}}</span>
                                {{--<span class="fr">{{$list['ordernumber']}}笔消费</span>--}}
                            </p>
                            <p class="fz_34 oh nearby_address">
                                <span class="fl">{{$list['districtname'] . $list['businessareaname']}}</span>
                                <!--<span class="fr"><100M</span>-->
                            </p>
                        </div>
                    </a>
                </li>
                @endforeach
            @else
                <!--  无数据 -->
                <li class="no_data tc fz_44 co_gray">
                    <img style="width: 4.9rem;height: 2.67rem;" src="{{env('IMAGE_DOMAIN')}}images/no_data.png?v={{env('IMAGE_VERSION')}}" alt=""><br>
                    <span>这里什么都木有</span>
                </li>
            @endif
		</ul>
	</section>
	<input type="hidden" name="page" id="page" value="{$page}"/>
    <input type="hidden" name="totalpage" id="totalpage" value="{$totalpage}"/>
    <input type="hidden" name="cityid" id="cityid" value="{$cityid}"/>
    <input type="hidden" name="areaid" id="areaid" value="{$areaid}"/>

@endsection

@section('scriptResources')
    @parent
<script>
	window.onresize=function(){
		pagesp();
	}
	// function keyup(){
	// 	var SRct=$(".search_contant").val();
	// 	if (SRct!="") {
 //            $("#submit_search2").show();
	// 		$("#submit_search1").hide();
	// 	}else{
 //            $("#submit_search2").hide()
	// 		$("#submit_search1").show()
	// 	}
	// }
	$(function(){
        // $("#submit_search2").click(function(){
        //     $(".search_contant").val("");
        //     $("#submit_search2").hide()
        //     $("#submit_search1").show()
        // })
		$(".search_result_delete").click(function(){
			$(".search_contant").val("");
			$(".search_result_delete").css('display','none')
		})
		// for (var i = 0; i < $(".busy_name").length; i++) {//商家名称字数限定
  //           if($(".busy_name").eq(i).html().length>8){
  //               var nearby_busyhtml=$(".busy_name").eq(i).html().substring(0,7);
  //               // alert($(".busy_name").eq(i).html())
  //               $(".busy_name").eq(i).html(nearby_busyhtml+"...");
  //           }
  //       };
		var el = document.getElementById('thelist');
        var page = $('#page').val() ;
        var cityid = $('#cityid').val();
        var areaid = $('#areaid').val();
	})
    $("#submit_search1").click(function() {
        var search = $("input[name='search']").val();
        if(search == '') {
            alert('请输入搜索内容'); return;
        }
        window.location.href= "/mobile/shop/search/result?search=" + search;
    });
</script>
@endsection